package com.cn.wanxi.service;

import com.cn.wanxi.dao.CompanyDao;
import com.cn.wanxi.model.CompanyModel;

/**
 * 所有的逻辑关系放在服务逻辑层
 * 封装数据的地方
 */
public class CompanyService implements ICompanyService{
    /**
     * 尽量避免使用全局变量
     */
//    public CompanyModel companyModel = null;

//    {
//        setCompanyModel();
//    }
//
//    static {
//        new CompanyService().setCompanyModel();
//    }

//    public CompanyService() {
//        setCompanyModel();
//    }

    public CompanyModel setCompanyModel() {

        CompanyModel companyModel = new CompanyModel();
        CompanyDao companyDao = new CompanyDao();
        companyModel.setLogo(companyDao.getLogo());
        companyModel.setPhone(companyDao.getPhone());
        companyModel.setNet(companyDao.getNet());
        companyModel.setEmail(companyDao.getEmail());
        companyModel.setLinePhone(companyDao.getLinePhone());
        companyModel.setAddress(companyDao.getAddress());
        companyModel.setVersion(companyDao.getVersion());
        return companyModel;
    }
}
